MATLAB draw plot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
% Set some nice settings.
grid on;
format long;

% Hold the graphics output until we are good to go.
hold all;

% To create some random test data.
x1 = 100 : 100 : 1000;
raw_y1 = [0.76,0.79,0.80,0.80,0.81,0.82,0.82,0.82,0.82,0.81];
raw_y2 = [0.85,0.81,0.83,0.83,0.82,0.79,0.78,0.80,0.82,0.82];
raw_y3 = [0.85,0.84,0.83,0.83,0.83,0.83,0.82,0.82,0.82,0.82];
legendText = cell(0);

plot(x1,y1,'--go','MarkerSize',5, 'MarkerFaceColor','g', 'LineWidth',3);
legendText(end+1) = { 'CUB' };

plot(x1,y2,':bo', 'MarkerSize',5, 'MarkerFaceColor','b', 'LineWidth',3);
legendText(end+1) = { 'SUN' };

plot(x1,y3,'-ro', 'MarkerSize',5, 'MarkerFaceColor','r', 'LineWidth',3);
legendText(end+1) = { 'Dogs' };

xlim([100 1000]);
ylim([0.72 0.90]);

set(gca,'fontsize',15)

% set sticks on x and y axis
get(gca, 'xtick');
set(gca, 'xtick', 100:100:1000);
get(gca, 'ytick');
set(gca, 'ytick', 0.72:0.02:0.90);

xlabel('# web training instances per category');
ylabel('Accuracy');

legend(legendText,'location','southeast');

hold off;